import java.util.Scanner;

public class emulateLogin {

    public static void main(String[] args) {
        System.out.println("请设置你的密码：");
        Scanner scan = new Scanner( System.in);
        String string = scan.next();

        int i = 1;
        while(i <= 3){
            System.out.println("请输入你的密码：");
            Scanner scanIn = new Scanner(System.in);
            String stringIn = scan.next();
            ++ i;
            if(string.equals(stringIn)){
                System.out.println("登录成功！");
                i --;
                break;
            }
            System.out.println("密码输入错误，请重新尝试！");
        }
        if(i == 4){
            System.out.println("密码输入错误次数过多，程序退出！");
        }
    }
}
